bitkeeper revision 1.1159.269.8 (423ab2eapL4QIhT8q2gPBPlVaSKmZw)
authormjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Fri, 18 Mar 2005 10:52:26 +0000 (10:52 +0000)
committermjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Fri, 18 Mar 2005 10:52:26 +0000 (10:52 +0000)
Script and xdm config to connect vnc in a domain back to
a viewer running in domain-0.

Signed-off-by: Mike Wray <mike.wray@hp.com>
.rootkeys
tools/examples/vnc/Xservers [new file with mode: 0644]
tools/examples/vnc/Xvnc-xen [new file with mode: 0755]

index f5baebe00f6e5615f32eb8e7663b0fcbbbb9e76d..e6850544078b8a70e54d1200a3adeffa12fbbf36 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 40ee75a967sxgcRY4Q7zXoVUaJ4flA tools/examples/vif-bridge
 41fc0c18AFAVXA1uGm1JFWHMeeznVw tools/examples/vif-nat
 41e661e1ooiRKlOfwumG6wwzc0PdhQ tools/examples/vif-route
+423ab2eaNCzxk3c-9yU1BwzxWvsDCQ tools/examples/vnc/Xservers
+423ab2ea7ajZLdZOI-8Z-bpNdNhhAQ tools/examples/vnc/Xvnc-xen
 40ee75a93cqxHp6MiYXxxwR5j2_8QQ tools/examples/xend-config.sxp
 41090ec8Pj_bkgCBpg2W7WfmNkumEA tools/examples/xmexample1
 40cf2937oKlROYOJTN8GWwWM5AmjBg tools/examples/xmexample2
diff --git a/tools/examples/vnc/Xservers b/tools/examples/vnc/Xservers
new file mode 100644 (file)
index 0000000..adc5748
--- /dev/null
@@ -0,0 +1,5 @@
+# Configuration lines to go in /etc/X11/xdm/Xservers to
+# start Xvnc and connect back to a vncviewer in domain-0.
+# See 'man xdm' under 'LOCAL SERVER SPECIFICATION' for format details.
+
+:1 Xvnc local /usr/X11R6/bin/Xvnc-xen :1
\ No newline at end of file
diff --git a/tools/examples/vnc/Xvnc-xen b/tools/examples/vnc/Xvnc-xen
new file mode 100755 (executable)
index 0000000..15058e6
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/bash
+#============================================================================
+# This script should be installed in /usr/X11R6/bin/Xvnc-xen.
+#============================================================================
+#
+# Start Xvnc and use vncconnect to connect back to a vncviewer listening in
+# domain 0. The host and port to connect to are given by
+#
+#    VNC_VIEWER=<host>:<port>
+#
+# in the kernel command line (/proc/cmdline). 
+#
+# The '--vnc' option to 'xm create' will start a vncviewer and
+# pass its address in VNC_VIEWER for this script to find.
+#
+# Usage:
+#        Xvnc-xen [args]
+#
+# Any arguments are passed to Xvnc.
+#
+#============================================================================
+
+# Prefix for messages.
+M="[$(basename $0)]"
+
+# Usage: vnc_addr
+# Print <host>:<port> for the vncviewer given in
+# the kernel command line.
+vnc_addr () {
+    sed -n -e "s/.*VNC_VIEWER=\([^ ]*\).*/\1/p" /proc/cmdline
+}
+
+# Usage: vnc_connect
+# If a vncviewer address was given on the kernel command line,
+# run vncconnect for it.
+vnc_connect () {
+    local addr=$(vnc_addr)
+
+    if [ -n "${addr}" ] ; then
+        echo "$M Connecting to ${addr}."
+        vncconnect ${addr}
+    else
+        echo "$M No VNC_VIEWER in kernel command line."
+        echo "$M Create the domain with 'xm create --vnc <display>'."
+        return 1
+    fi
+}
+
+# Start the vnc server.
+Xvnc "$@" >/dev/null 2>&1 &
+
+# Connect back to the viewer in domain-0.
+vnc_connect